/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rational.sheet.table.row;

import javax.swing.JList;
import javax.swing.JTable;

/**
 *
 * @author Overmind
 */
public class RowHeader
    extends JList
{
    private JTable table;
    
    public RowHeader(JTable table)
    {
	super(new RowHeaderListModel(table));
	
	setTable(table);

	
    }
    
    public JTable getTable()
    {
	return table;
    }
    
    public RowHeaderListModel getRowHeaderListModel()
    {
	return (RowHeaderListModel)getModel();
    }
    
    public final void setTable(JTable table)
    {
	this.table = table;
	
	setFixedCellHeight(table.getRowHeight());
	setCellRenderer(new RowHeaderRenderer(table));
	this.addMouseListener(new RowHeaderMouseAdapter(table, this));
	table.addAncestorListener(new RowHeaderAncestorAdapter(table, this));
    }
    
}

